//MePage.js
const app = getApp();
var userInfo_2 = ""; //为了和系统的userInfo相区别, 添加尾缀
App();
Page({
    data: {
        canIUse: wx.canIUse('button.open-type.getUserInfo'),
        loginStatus: false
    },
    onLoad: function () {
        // 查看是否授权
        wx.getSetting({
            success(res) {
                if (res.authSetting['scope.userInfo']) {
                    // 已经授权，可以直接调用 getUserInfo 获取头像昵称
                    wx.getUserInfo({
                        success: function (res) {
                            console.log(res.userInfo)
                        }
                    })
                }
            },
        })
    },
    bindGetUserInfo(e) {
        this.setData({})
    },
    /*
    微信登录
    */
    wxLogIn: function (params) {
        let that = this;
        wx.cloud.callFunction({
            name: "login",
            complete: res => {
                this.userInfo_2 = res.result;
                wx.setStorage({
                    key: "userInfo_2",
                    data: that.userInfo_2
                })
            }
        });

    }
})